<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>任务调度日志页</title>
    <meta name="author" content="师师2020" />
    <link rel="stylesheet" th:href="@{/iview/iview.css}">
    <script th:src="@{/libs/jquery-3.2.1.min.js}" type="text/javascript"></script>
	<script th:src="@{/libs/vue.min.js}" type="text/javascript"></script>
	<script th:src="@{/layer/layer.js}" type="text/javascript"></script>
	<script th:src="@{/iview/iview.min.js}" type="text/javascript"></script>
	<script th:src="@{/common.js}" type="text/javascript"></script>
    <style type="text/css">
	[v-cloak] {
			  display: none;
			}
	</style>
</head>
<body>
<div id="app" v-cloak>
        <div style="margin-bottom: 6px;margin: 30px">
			<i-input v-model="content" placeholder="任务名称"  style="width: 300px"></i-input>
			<!--<i-input type="date" v-model="theSelectData" placeholder="选择时间" style="width: 150px"></i-input>-->
			<template>
		<Date-picker type="datetime" v-model="theSelectData" format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期和时间" style="width: 200px"></Date-picker>
			</template>
				<i-button type="primary" @click="search()" icon="ios-search">搜索</i-button>
			<i-button type="primary" @click="empty()" icon="ios-close-empty">清空</i-button>
			<!--<i-button type="info" style="float: right;" @click="add()" icon="person-add">新增</i-button>-->
		</div>
		<div style="margin-bottom: 6px;margin: 15px">
			<template> 
				<i-table border :content="self" :columns="tableTitle" :data="JobData"></i-table>
			 	<br>
                <Page  style="float: right;" :current="pageNo" :total="tableSize" :page-size="pageSize"  @on-change="changePage" @on-page-size-change="changePageSize" show-elevator show-sizer show-total></Page>
			</template>
		</div>
</div>
<script type="text/javascript">
var vm = new Vue({
	el : '#app',
	data : {
		content : '',
		pageNo : 1,
		pageSize : 10,
		jobName : '',
		theSelectData:'',
		JobData : [],
		tableSize : 50,
		tableTitle:[ {
			key : "jobkey",
			title : "任务key"
		}, {
			key : "kettlepatch",
			title : "任务调用kettle全路径"
		}, {
			key : "begintime",
			title : "任务开始时间"
		}, {
			key : "endtime",
			title : "任务结束时间"
		},{
			key : "status",
			title : "任务状态"
		},{
			key : "message",
			title : "执行详情"
		}]

	},
	methods : {
		//搜索
		search : function(){
			if(vm.theSelectData != null && vm.theSelectData != ''){
				var d = new Date(vm.theSelectData);
				var datetime=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
			}
			$.ajax({
					url:"../job/listLog",
					type:"post",
					data:{'JOBKEY':this.content,"pageNo":this.pageNo,'pageSize':this.pageSize,'THESELECTDATA':datetime},
					success: function(result) {
						vm.JobData = result.msg.pageData;
						vm.tableSize = result.msg.totalCount;
					}
			});
		},
		//任务列表(自行实现分页)
		list : function() {
			$.ajax({
				url:"../job/listLog",
				type:"post",
				data:{'time':(new Date()).toString(),"pageNo":this.pageNo,'pageSize':this.pageSize},
				success: function(result) {
					vm.JobData = result.msg.pageData;
					vm.tableSize = result.msg.totalCount;
				}
			});
		},
		reload :  function(){
			vm.list();
        },
        changePage : function(pageNo) {
            vm.pageNo = pageNo;
			vm.search();
        },
        changePageSize : function(pageSize) {
            vm.pageSize = pageSize;
			vm.search();
        }
	},
	created : function() {
		this.list();
	}
})

</script>
</body>
</html>